package com.hopu.blb_erp.service.impl;

import com.hopu.blb_erp.entity.Department;
import com.hopu.blb_erp.mapper.DepartmentMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hopu.blb_erp.service.DepartmentService;
import com.hopu.blb_erp.service.IDepartmentService;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author A-Zhang
 * @since 2021-11-17
 */
@Service
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements IDepartmentService,DepartmentService {
    @Autowired
    private DepartmentMapper departmentMapper;

    @Override
    public Department findDepartmentByStaffId(Integer id) {
        return departmentMapper.selectDepartmentByStaffId(id);
    }
    @Override
    public Department findById(Integer id) {
        return departmentMapper.selectById(id);
    }

    @Override
    public List<Department> findTree() {
        return departmentMapper.selectTree();
    }

    @Override
    public void addDepart(Department department) {
        departmentMapper.insertDepart(department);
    }

    @Override
    public void modifyDepart(Department department) {
        departmentMapper.updateDepart(department);
    }

    @Override
    public void removeDepart(Integer id) {
        departmentMapper.deleteDepart(id);
    }
}
